package org.groovyflow.validation

class ObjectValidator extends Validator{
     public  ObjectValidator(){}
     public  ObjectValidator(toValidate){super(toValidate)}

    def validate(){
       if(validations instanceof Map)
           validations.each{key, closu ->
              this.validateImpl(key, closu);  
          }
      else if(validations instanceof List)
           validations.each{elem ->
              this.validateImpl(elem[0], elem[1]);  
          }  
      else
        throw new RuntimeException("validations must be either a map or a list")      
    }
}